package com.adu.demo.controller;
import java.util.List;
import com.adu.demo.domain.SysUser;
import com.adu.demo.service.Impl.SysUserService;
import com.adu.demo.util.JsonResult;
import com.adu.demo.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
                                            // 测试
@RestController
@RequestMapping("/SysUser")
public class SysUserController extends BaseController {
    @Autowired
    private SysUserService sysuserService;

    @GetMapping("/getList")
    public Result getList(@RequestBody SysUser sysuser){
        startPage();
        List<SysUser> sysuserList=sysuserService.getList(sysuser);
        return JsonResult.OK(200,"success",sysuserList);
    }

    @GetMapping("/getById")
    public Result getById(Long id){
        SysUser sysuser=sysuserService.getById(id);
        return JsonResult.OK(200,"success",sysuser);
    }
    @PostMapping("/save")
    public Result save(@RequestBody SysUser sysuser){
        sysuserService.save(sysuser);
        return JsonResult.OK(200,"success");
    }
    @DeleteMapping("/removeBatch")
    public Result remove(@PathVariable Long[] ids){
        sysuserService.deleteByIds(ids);
        return JsonResult.OK(200,"success");
    }
    @DeleteMapping("/remove")
    public Result remove(@PathVariable Long id){
        sysuserService.deleteById(id);
        return JsonResult.OK(200,"success");
    }
    @GetMapping("/update")
    public Result update(@RequestBody SysUser sysuser){
        sysuserService.update(sysuser);
        return JsonResult.OK(200,"success");
    }
}